import React, { ReactNode, useEffect, useState } from 'react';
import { View, Image } from '@tarojs/components';
import Taro from '@tarojs/taro';
import './index.less';
//注册和登录页面的返回按钮
interface TitleBarLeftProps {
  flag?: boolean; // 标题文字
}

const TitleBarLeft: React.FC<TitleBarLeftProps> = ({ flag }) => {
  const handleBack = () => {
    //注册页面返回，首页不可返回
    if (flag) {
      Taro.navigateBack();
    }
  };
  return (
    <View className="custom-left-container">
      <View className="custom-left-content" onClick={() => handleBack()}>
        <Image
          className="tb-back"
          src={'https://file.linkcook.cn/image/wineMiniProgram/home-back.png'}
        />
        <Image
          className="tb-home"
          src={'https://file.linkcook.cn/image/wineMiniProgram/home.png'}
        />
      </View>
    </View>
  );
};

export default TitleBarLeft;
